package com.jdzy.student.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jdzy.model.student.pojos.StudentTagRelation;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


@Mapper
public interface StudentTagRelationMapper extends BaseMapper<StudentTagRelation> {
    // 根据学号查询学生标签关系
    @Select("SELECT * FROM student_tag_relation WHERE stu_id = #{stuId}")
    List<StudentTagRelation> getStudentTagRelationsByStuId(@Param("stuId") String stuId);

    // 根据学号删除学生标签关系
    @Delete("DELETE FROM student_tag_relation WHERE stu_id = #{stuId} AND tag_id = #{tagId}")
    int deleteStudentTagRelation(@Param("stuId") String stuId, @Param("tagId") Long tagId);
}
